package com;

import com.lcy.mapper.MemberMapper;
import com.lcy.model.Member;
import com.lcy.mybatis.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/1/12.
 */
public class Demo {
    @Test
    public void test(){
        SqlSession ss= MyBatisUtil.getSqlSession();
        MemberMapper mm=ss.getMapper(MemberMapper.class);
        Member ms=mm.queryById(1);
        System.out.println(ms);
        ss.commit();
        ss.close();
    }
@Test
    public void ok(){
        SqlSession ss = MyBatisUtil.getSqlSession();
        MemberMapper mm = ss.getMapper(MemberMapper.class);
        List<Map<String,Object>> mb = mm.query();
        for(Map<String,Object> mmb : mb){
            System.out.println(mmb);
        }
    }
    @Test
    public void okt(){
        SqlSession ss = MyBatisUtil.getSqlSession();
        MemberMapper mm = ss.getMapper(MemberMapper.class);
        List<Map<String,Object>> ls = mm.queryAll();
        for (Map<String,Object> mb : ls){
            System.out.println(mb);
        }
    }

}
